<?php
/**
 * This file is part of Hyperf Mall.
 *
 * @link     https://gitee.com/scwlkj/hyperf_mall
 * @contact  hyperf_mall@163.com
 */

namespace App\JsonRpc;

use App\Repository\AfterSaleRepository;
use Hyperf\RpcServer\Annotation\RpcService;
use App\JsonRpc\Interfaces\AfterSaleServiceInterface;

/**
 * @RpcService(name="Orders::AfterSaleService", protocol="jsonrpc", server="jsonrpc")
 */
class AfterSaleService extends BaseService implements AfterSaleServiceInterface
{
    public function init()
    {
        $this->repository = AfterSaleRepository::getInstance();
    }

    /**
     * Notes:C端 我的售后列表
     * Author: Bruce.z
     * DateTime: 2022/8/19 9:48
     * @param array $data
     * @return array
     */
    public function appList(array $data):array
    {
        return $this->repository->appList($data);
    }

    /**
     * Notes: C端 售后订单详情
     * Author: Bruce.z
     * DateTime: 2022/8/19 10:21
     * @param $number
     * @return array
     */
    public function appDetail($number):array
    {
        return $this->repository->appDetail($number);
    }

    /**
     * Notes:A端 售后订单列表
     * Author: Bruce.z
     * DateTime: 2022/8/19 17:39
     * @param array $data
     * @return array
     */
    public function list(array $data):array
    {
        return $this->repository->list($data);
    }

    /**
     * Notes: A端 拒绝售后申请
     * Author: Bruce.z
     * DateTime: 2022/8/22 9:28
     * @param string $number
     * @param string $reason
     * @return mixed
     */
    public function refuse(string $number, string $reason):bool
    {
        return $this->repository->refuse($number, $reason);
    }

    /**
     * Notes:A端 同意售后申请
     * Author: Bruce.z
     * DateTime: 2022/8/22 11:24
     * @param string $number
     * @return bool
     */
    public function agree(string $number):bool
    {
        return $this->repository->agree($number);
    }

    /**
     * Notes:  A端 售后订单详情
     * Author: Bruce.z
     * DateTime: 2022/8/22 17:36
     * @param $number
     * @return array
     */
    public function info($number):array
    {
        return $this->repository->info($number);
    }

    /**
     * Notes: 申请售后 详情
     * Author: Bruce.z
     * DateTime: 2022/10/28 17:40
     * @param int $order_detail_id
     * @return mixed
     */
    public function applyPre(int $order_detail_id)
    {
        return $this->repository->applyPre($order_detail_id);
    }
}
